﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DOTNETGROUP.Data;
using DOTNETGROUP.Entities;

public partial class Tuyen_Dung : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            HienThi_TuyenDung();
            HienThi_TuyenDung2();
        }
    }
    /// <summary>
    /// Thuc hien hien thi danh sach tin tuc va phan trang
    /// </summary>
    /// <param name="pageNo"></param>
    protected void HienThi_TuyenDung()
    {
        int totals = 0;
        TList<TuyenDung> tlistTuyenDungs = DataRepository.TuyenDungProvider.GetPaged("", "NgayCapNhat DESC", 0, 1, out totals);
        if (tlistTuyenDungs.Count > 0)
        {
            dtlDsTuyenDung.DataSource = tlistTuyenDungs;
            dtlDsTuyenDung.DataBind();
        }
        
    }
    protected void HienThi_TuyenDung2()
    {
        int totalRows = 0;
        string WhereClause = "1=1 AND Id not in (select Top 1 ID from TuyenDung order by NgayCapNhat DESC) ";
        TList<TuyenDung> Tlist_TuyenDung = DataRepository.TuyenDungProvider.GetPaged(WhereClause, "NgayCapNhat DESC", 0, 15, out totalRows);
        if (Tlist_TuyenDung.Count > 0)
        {
            dlTuyenDung2.DataSource = Tlist_TuyenDung;
            dlTuyenDung2.DataBind();
        }

    }

    /// <summary>
    /// Phuong thuc chuyen tieu de co dau thanh khong dau de dua vao link
    /// </summary>
    /// <param name="Char"></param>
    /// <returns></returns>
    public string GetTieuDe(object Char)
    {
        string s = Char.ToString();
        return Common.ConvertToUnSign(s);
    }

    /// <summary>
    /// Format cat chuoi
    /// </summary>
    /// <param name="str"></param>
    /// <param name="n"></param>
    /// <returns></returns>
    public string formatString(string str, int n)
    {
        string kq = "";

        if (str.Length > n)
            kq = str.Substring(0, n + 1) + "...";
        else
            kq = str;

        return kq;
    }
}